﻿Imports Cls_Common
Imports VSModel

Partial Class FrontEnd_Control_Home_BigBannerHome
    Inherits System.Web.UI.UserControl
    Public strQuangCao As String = ""
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Bind2Repeater()
        End If
    End Sub
    Protected Sub Bind2Repeater()

        'random 1 --> arr cua list Quang cao
        Dim arrFileName As String() = ConfigurationManager.AppSettings("arrFlashHome").ToString.Split(",")
        If Session("AdId") Is Nothing Then
            Static rnd As New Random
            Dim r As Integer = rnd.Next(arrFileName.Length)
        End If
        Dim curAds As String
        Session("AdId") = Session("AdId") + 1
        If Session("AdId") - 1 > arrFileName.Length - 1 Then
            Session("AdId") = 1
            curAds = arrFileName(Session("AdId") - 1)
        Else
            curAds = arrFileName(Session("AdId") - 1)
        End If


        strQuangCao = strQuangCao & "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='490' height='310'>"
        strQuangCao = strQuangCao & "	<param name='movie' value='" + curAds.Trim() + "'>"
        strQuangCao = strQuangCao & "	<param name='quality' value='high'>"
        strQuangCao = strQuangCao & "	<param name='menu' value='false'>"
        strQuangCao = strQuangCao & "	<param name='wmode' value='transparent'> "
        strQuangCao = strQuangCao & "	<param name='pluginurl' value='http://www.macromedia.com/go/getflashplayer'> "
        strQuangCao = strQuangCao & "	<param name='SWRemote' value=''>"
        strQuangCao = strQuangCao & "	<embed src='" + curAds.Trim() + "' quality='high' wmode='transparent' width='490' height='310' name='MyMovieName' align='' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'>"
        strQuangCao = strQuangCao & "</object>"



        'Using _data As New VSEntities
        '    Dim p = (From q In _data.ImagesAdvers Where q.StatusID = 3 And q.Subject = ImageAdverType.BannerHome Select q Order By q.Sort).ToList
        '    With rptImage
        '        .DataSource = p
        '        .DataBind()
        '    End With
        'End Using

    End Sub


    'Protected Sub rptImage_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptImage.ItemDataBound
    '    Dim row As VSModel.ImagesAdver = CType(e.Item.DataItem, VSModel.ImagesAdver)
    '    Dim hplTitle As HyperLink = CType(e.Item.FindControl("hplTitle"), HyperLink)

    '    '   Dim ltrTitle As Literal = CType(e.Item.FindControl("ltrTitle"), Literal)
    '    hplTitle.NavigateUrl = row.URL
    '    Dim imgBig As Image = CType(e.Item.FindControl("imgBig"), Image)
    '    imgBig.ImageUrl = row.SRC
    '    ' ltrTitle.Text = row.Title

    ' End Sub



End Class
